<?php

/**
 * Yii MyMenu Widget 
 *
 * @author luunguyen
 * @since Sep 24, 2012 - 1:58:44 PM
 */
Yii::import('zii.widgets.CMenu');

class OpendevMenu extends CMenu
{

    public function init()
    {
        parent::init();

        foreach ($this->items as $key => $item)
        {
            if ($this->isItemActive($item, ''))
            {
                $item['linkOptions'] = array('class' => $this->activeCssClass);
                $this->items[$key]   = $item;
            }
        }
    }

    protected function isItemActive($item, $route)
    {
        if (isset($item['url']) && strpos(Yii::app()->request->url, $item['url']) !== FALSE)
            return true;
        return false;
    }

}

/** 
 * End file MyMenu
 */
